package com.bytehill.Now;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.CompoundButton;
import android.widget.CheckBox;
import android.widget.RadioButton;

import java.util.Date;

public class Now extends Activity implements View.OnClickListener, CompoundButton.OnCheckedChangeListener
{
    Button btn;
    CheckBox cb;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        btn = new Button(this);
        btn.setOnClickListener(this);
        updateTime();
        setContentView(R.layout.main);

        EditText fld=(EditText)findViewById(R.id.field);
        fld.setText("Note: If you put \"slow\" options in LS_OPTIONS, it will not force the activation of \"slow mode\".");

        cb = (CheckBox)findViewById(R.id.check);
        cb.setOnCheckedChangeListener(this);

        RadioButton rb = (RadioButton)findViewById(R.id.radio1);
        rb.setChecked(true);
    }
    public void onClick(View view)
    {
        updateTime();
    }
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
    {
        if(isChecked){
            cb.setText("This checkbox is: checked");
        }
        else{
            cb.setText("This checkbos is: unchecked");
        }
    }
    private void updateTime()
    {
        btn.setText(new Date().toString());
    }

}
